package com.kingwang.training.designpattern.abstractfactory;

import com.kingwang.training.designpattern.abstractfactory.email.EmailSender;
import com.kingwang.training.designpattern.abstractfactory.sms.SmsSender;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application implements ApplicationRunner {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @Override
    public void run(ApplicationArguments args) throws Exception {
        NotificationFactory factory = new BeijingNotificationFactory();

        SmsSender smsSender = factory.createSmsSender();
        EmailSender emailSender = factory.createEmailSender();

        smsSender.send("msg");
        emailSender.send("email", "subject", "msg");
    }
}
